android 资源

资料

Resource Types
More Resource Types

Resource Types

Each of the documents in this section describe the usage, format and syntax for a certain type of application resource that you can provide in your resources directory (res/).

  1. Animation Resources
    Define pre-determined animations.
    Tween animations are saved in res/anim/ and accessed from the R.anim class.
    Frame animations are saved in res/drawable/ and accessed from the R.drawable class.
  2. Color State List Resource
    Define a color resources that changes based on the View state.
    Saved in res/color/ and accessed from the R.color class.
  3. Drawable Resources
    Define various graphics with bitmaps or XML.
    Saved in res/drawable/ and accessed from the R.drawable class.
  4. Layout Resource
    Define the layout for your application UI.
    Saved in res/layout/ and accessed from the R.layout class.
  5. Menu Resource
    Define the contents of your application menus.
    Saved in res/menu/ and accessed from the R.menu class.
  6. String Resources
    Define strings, string arrays, and plurals (and include string formatting and styling).
    Saved in res/values/ and accessed from the R.string, R.array, and R.plurals classes.
  7. Style Resource
    Define the look and format for UI elements.
    Saved in res/values/ and accessed from the R.style class.
  8. Font Resources
    Define font families and include custom fonts in XML.
    Saved in res/font/ and accessed from the R.font class.
  9. More Resource Types
    Define values such as booleans, integers, dimensions, colors, and other arrays.
    Saved in res/values/ but each accessed from unique R sub-classes (such as R.bool, R.integer, R.dimen, etc.).

More Resource Types

This page defines more types of resources you can externalize, including:

  1. Bool
    XML resource that carries a boolean value.
  2. Color
    XML resource that carries a color value (a hexadecimal color).
  3. Dimension
    XML resource that carries a dimension value (with a unit of measure).
  4. ID
    XML resource that provides a unique identifier for application resources and components.
  5. Integer
    XML resource that carries an integer value.
  6. Integer Array
    XML resource that provides an array of integers.
  7. Typed Array
    XML resource that provides a TypedArray (which you can use for an array of drawables)